<link href="<?=base_url(); ?>theme/css/basic.css" rel="stylesheet" type="text/css">
 <div class="noty_bar noty_theme_default noty_layout_topCenter noty_error" id="message_error_formAddPurchase" style="cursor: pointer; left: 559.5px;">
    <div class="noty_message"><span id="contentMessageErrorFormAddPurchase" class="noty_text">No hay movimientos para estos parámetros</span></div>
    </div>
<div class="grid_container">

    <form id="formAddPurchase" method="post" class="form_container">
        <div class="grid_12">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon magnifying_glass"></span>
                    <h6>
                      Reporte de Ventas
                    </h6>
                </div>

                <div class="widget_content" style="margin-bottom: 30px">
                    <ul id="datos">
                         
                        <li>
                            <div class="form_grid_12">
                                <div class="form_input">
                                    <div class="form_grid_2">
                                        <span style="margin-left: -10px;" class="label_head">Desde</span>
                                        <input style="margin-left: -10px;" type="text" name="desde" id="desde" value="" placeholder = "dd/mm/yyyy" required>
                                    </div>
                                    <div class="form_grid_2">
                                        <span style="margin-left: 107px;" class="label_head">Hasta</span>
                                        <input  style="margin-left: 107px;" type="text" name="hasta" id="hasta" value="" placeholder = "dd/mm/yyyy" required>

                                    </div>
                                    <span class="clear"></span>
                                </div>
                            </div>
                        </li>

                        <li>
                            
                                   <div class="form_grid_5 alpha">
                                       <button style="margin-left: 10px;margin-top: 25px;size: 120px" id="Reporte" class="btn_small btn_blue"><span>  Reporte  </span></button>                                   
                                       
                                    </div>                                   
                                    <span class="clear"></span>
                        </li>
                        <li>
                                 
                        </li>
                    </ul>
                                   <script>

    $(document).ready(function(){
           
        $('#Reporte').click(function(e) {
            var warehouses = $('#warehouses').val();
            if(warehouses ==0)
                {}
                else
                    {
            $('#ware').val(warehouses);
                    }
                    
        });
    
 });

</script>
                                    <script>
                                        $(document).ready(function() {
                                            
                                            $('#Reporte').click(function(e) {
                                                
                                                                         
                                            $("#formAddPurchase").validate({
                                                                
                               rules: {
                                   
                                   desde: {              //input name: email
                                       required: true   //required boolean: true/false                                          //required boolean: true/false
                                   },
                                   hasta: {            //input name: subject
                                       required: true   //required boolean: true/false                                   
                                   }
                                  
                               },
                               
                               messages: {               //messages to appear on error
                                
                                   desde: { 
                                         required: "Ingrese una fecha de Inicio"
                                         },
                                   hasta: {
                                         required: "Ingrese una fecha de Final"                                        
                                         }
                               },
                                 submitHandler: function(form){
                                               /* var code = $('#code1').val();*/
                                              //  var warehouses = $('#warehouses').val();                                                
                                                var desde = $('#desde').val();
                                                var hasta = $('#hasta').val();                                                             
                                $.ajax({
                                                    
                                                    cache: true,
                                                    'url': url + '/kardex/reporte_sales/',
                                                    'type': 'POST',
                                                    'data': {
                                                       /* 'code1': code,
                                                        'warehouses': warehouses,*/
                                                        'desde': desde,
                                                        'hasta': hasta
                                                    },
                                                    'success': function(res) {
                                                         if(res==0)
                                                            {
                                                                $('div[id=message_error_formAddPurchase]').css('display', 'block');
                                                            }                                
                                                            else
                                                            {
                                                            $('#reporte_kardex').html(res);
                                                            //$('#reporte_kardex').modal();
                                                            $('div[id=message_error_formAddPurchase]').css('display', 'none');
                                                            }
                                                        
                                                    }
                                                    ,
                                                
                                                });
                        }
                           });  
                                                                                            
                                            });

                                        })
                                    </script>
                                    
                                    <script>
                            $(document).ready(function() {
                                
                                $('#addProduct').click(function(e) {
                                    
                                    $.ajax({
                                        'url': url + '/kardex/products/',
                                        'type': 'POST',
                                        'data': {
                                            'code': '',
                                            'description': ''
                                        },
                                        'success': function(res) {
                                           
                                        }
                                    });
                                    
                                    return false;
                                });

                            })
                                    </script>
                                     
                                    
                                    <span class="clear"></span>
                </div>
            </div>
        </div>
                        </form>
</div>

<div id="add-product-model">
</div>
<div id="reporte_kardex">
</div>
